package com.iqik.sc.controller;

import com.iqik.sc.ns.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    private EmailService service;

    @RequestMapping("/{email}/{code}")
    public String sendCode(@PathVariable(value = "email") String email,
                           @PathVariable(value = "code") String code) {
        System.out.println("send code " + code + " to " + email);
        return service.sendCode(email, code) ? "true": "false";
    }

}
